#include <stdio.h>
#include <stdlib.h>
#include "stdsoap2.h"
#include "soapH.h"
#include "login.nsmap"
int main(int argc, char* argv[])
{
	int m, s;
	struct soap login_soap;
	soap_init(&login_soap);
	//soap_set_namespaces(&login_soap, add_namespaces);
	if (argc < 2)
	{
		printf("usage: %s <server_port> \n", argv[0]);
		exit(1);
	}
	else
	{
		m = soap_bind(&login_soap, NULL, atoi(argv[1]), 100);
		if (m < 0)
		{
			soap_print_fault(&login_soap, stderr);
			exit(-1);
		}
		fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
		for ( ; ; )
		{
			s = soap_accept(&login_soap);
			if (s < 0)
			{
				soap_print_fault(&login_soap, stderr);
				exit(-1);
			}
			fprintf(stderr, "Socket connection successful: slave socket = %d\n", s);
			soap_serve(&login_soap);//该句说明该server的服务
			soap_end(&login_soap);
		}
	}
	return 0;
}

int ns2__login(char *ppstrUser, char *ppstrPass, int* piResult )
{
	*piResult=1;
	if(0==strcmp(ppstrUser,"admin")&&0==strcmp(ppstrPass,"admin"))
	{
		*piResult=0;
	}
	return 0;
}
